describe("MoveAmountController unit test", function(){

    var moveAmountController = null;

    beforeEach(function(){

        var t_alertCtrl = App.AlertController.create();
        var t_loadingCtrl = App.LoadingController.create();
        var t_moveHolderCtrl = App.MoveHolderController.create();
        App.MoveAmountController.reopen({

            init:function(){
                this.set('controllers.alert', t_alertCtrl);
                this.set('controllers.loading', t_loadingCtrl);
                this.set('controllers.moveHolder', t_moveHolderCtrl);
            }
        });

        moveAmountController = App.MoveAmountController.create();
    });

    describe("controller unit test", function(){

    	var transfer = App.OwnAccountTransfer.create();
        beforeEach(function(){
            spyOn(App.getSession(),'getCurrentTransfer').andReturn(transfer);
        });

        it("prepareController unit test", function(){

            spyOn(moveAmountController, 'set');
            moveAmountController.prepareController();
            expect(App.getSession().getCurrentTransfer).toHaveBeenCalled();
        });


        it("continueAction", function(){
            //prepare
            var _amount = '10.00';
            var _desc = 'test description';
            moveAmountController.set('amountVal', _amount);
            moveAmountController.set('description', _desc);
            spyOn(transfer, 'set');
            spyOn(transfer, 'validateAmount');
            spyOn(moveAmountController, 'transitionTo');

            //execute
            moveAmountController.continueAction();

            //verify
            expect(transfer.validateAmount).toHaveBeenCalledWith(_amount);
            expect(transfer.set).toHaveBeenCalledWith('amount', _amount);
            expect(transfer.set).toHaveBeenCalledWith('remark', _desc);
            expect(moveAmountController.transitionTo).toHaveBeenCalledWith('move.when');
        });
    })
})